home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Programming / fpc / amigaunits / gadtools.pas < prev    next >
Pascal/Delphi Source File  |  1998-09-22  |  23KB  |  711 lines

  1. {
  2.     This file is part of the Free Pascal run time library.
  3.  
  4.     A file in Amiga system run time library.
  5.     Copyright (c) 1998 by Nils Sjoholm
  6.     member of the Amiga RTL development team.
  7.  
  8.     See the file COPYING.FPC, included in this distribution,
  9.     for details about the copyright.
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14.  
  15.  **********************************************************************}
  16.  
  17. unit gadtools;
  18.  
  19. INTERFACE
  20.  
  21. uses exec, intuition, graphics, utility;
  22.  
  23.  
  24. {------------------------------------------------------------------------}
  25.  
  26. {  The kinds (almost classes) of gadgets in the toolkit.  Use these
  27.     identifiers when calling CreateGadgetA() }
  28.  
  29. CONST
  30.  GENERIC_KIND  =  0;
  31.  BUTTON_KIND   =  1;
  32.  CHECKBOX_KIND =  2;
  33.  INTEGER_KIND  =  3;
  34.  LISTVIEW_KIND =  4;
  35.  MX_KIND       =  5;
  36.  NUMBER_KIND   =  6;
  37.  CYCLE_KIND    =  7;
  38.  PALETTE_KIND  =  8;
  39.  SCROLLER_KIND =  9;
  40. { Kind number 10 is reserved }
  41.  SLIDER_KIND   =  11;
  42.  STRING_KIND   =  12;
  43.  TEXT_KIND     =  13;
  44.  
  45.  NUM_KINDS     =  14;
  46.  
  47.  GADTOOLSNAME   : PChar = 'gadtools.library';
  48.  
  49.  
  50. {------------------------------------------------------------------------}
  51.  
  52. {  'Or' the appropriate set together for your Window IDCMPFlags: }
  53.  
  54.  ARROWIDCMP    =  (IDCMP_GADGETUP + IDCMP_GADGETDOWN +
  55.                    IDCMP_INTUITICKS + IDCMP_MOUSEBUTTONS);
  56.  
  57.  BUTTONIDCMP   =  (IDCMP_GADGETUP);
  58.  CHECKBOXIDCMP =  (IDCMP_GADGETUP);
  59.  INTEGERIDCMP  =  (IDCMP_GADGETUP);
  60.  LISTVIEWIDCMP =  (IDCMP_GADGETUP + IDCMP_GADGETDOWN +
  61.                    IDCMP_MOUSEMOVE + ARROWIDCMP);
  62.  
  63.  MXIDCMP       =  (IDCMP_GADGETDOWN);
  64.  NUMBERIDCMP   =  0;
  65.  CYCLEIDCMP    =  (IDCMP_GADGETUP);
  66.  PALETTEIDCMP  =  (IDCMP_GADGETUP);
  67.  
  68. {  Use ARROWIDCMP+SCROLLERIDCMP if your scrollers have arrows: }
  69.  SCROLLERIDCMP =  (IDCMP_GADGETUP + IDCMP_GADGETDOWN + IDCMP_MOUSEMOVE);
  70.  SLIDERIDCMP   =  (IDCMP_GADGETUP + IDCMP_GADGETDOWN + IDCMP_MOUSEMOVE);
  71.  STRINGIDCMP   =  (IDCMP_GADGETUP);
  72.  
  73.  TEXTIDCMP     =  0;
  74.  
  75.  
  76. {------------------------------------------------------------------------}
  77.  
  78. {  Generic NewGadget used by several of the gadget classes: }
  79.  
  80. Type
  81.    pNewGadget = ^tNewGadget;
  82.    tNewGadget = record
  83.     ng_LeftEdge, ng_TopEdge : Integer;     {  gadget position }
  84.     ng_Width, ng_Height     : Integer;     {  gadget size }
  85.     ng_GadgetText           : STRPTR;      {  gadget label }
  86.     ng_TextAttr             : pTextAttr;   {  desired font for gadget label }
  87.     ng_GadgetID             : Word;        {  gadget ID }
  88.     ng_Flags                : ULONG;       {  see below }
  89.     ng_VisualInfo           : Pointer;     {  Set to retval of GetVisualInfo() }
  90.     ng_UserData             : Pointer;     {  gadget UserData }
  91.    END;
  92.  
  93.  
  94. {  ng_Flags control certain aspects of the gadget.  The first five control
  95.     the placement of the descriptive text.  All larger groups supply a
  96.     default: }
  97.  
  98. CONST
  99.  PLACETEXT_LEFT  = $0001;  { Right-align text on left side }
  100.  PLACETEXT_RIGHT = $0002;  { Left-align text on right side }
  101.  PLACETEXT_ABOVE = $0004;  { Center text above }
  102.  PLACETEXT_BELOW = $0008;  { Center text below }
  103.  PLACETEXT_IN    = $0010;  { Center text on }
  104.  
  105.  NG_HIGHLABEL    = $0020;  { Highlight the label }
  106.  
  107. {------------------------------------------------------------------------}
  108.  
  109. { Fill out an array of these and pass that to CreateMenus(): }
  110.  
  111. Type
  112.    pNewMenu = ^tNewMenu;
  113.    tNewMenu = record
  114.     nm_Type           : Byte;              {  See below }
  115.     nm_Label          : STRPTR;            {  Menu's label }
  116.     nm_CommKey        : STRPTR;            {  MenuItem Command Key Equiv }
  117.     nm_Flags          : Word;              {  Menu OR MenuItem flags (see note) }
  118.     nm_MutualExclude  : Longint;           {  MenuItem MutualExclude word }
  119.     nm_UserData       : Pointer;           {  For your own use, see note }
  120.    END;
  121.  
  122. const
  123. { Needed only by inside IM_ definitions below }
  124.  MENU_IMAGE     = 128;
  125.  
  126. { nm_Type determines what each NewMenu structure corresponds to.
  127.  * for the NM_TITLE, NM_ITEM, and NM_SUB values, nm_Label should
  128.  * be a text string to use for that menu title, item, or sub-item.
  129.  * For IM_ITEM or IM_SUB, set nm_Label to point at the Image structure
  130.  * you wish to use for this item or sub-item.
  131.  * NOTE: At present, you may only use conventional images.
  132.  * Custom images created from Intuition image-classes do not work.
  133.  }
  134.  NM_TITLE      =  1;       { Menu header }
  135.  NM_ITEM       =  2;       { Textual menu item }
  136.  NM_SUB        =  3;       { Textual menu sub-item }
  137.  
  138.  IM_ITEM       =  (NM_ITEM OR MENU_IMAGE);    { Graphical menu item }
  139.  IM_SUB        =  (NM_SUB OR MENU_IMAGE);     { Graphical menu sub-item }
  140.  
  141. { The NewMenu array should be terminated with a NewMenu whose
  142.  * nm_Type equals NM_END.
  143.  }
  144.  NM_END        =  0;       { End of NewMenu array }
  145.  
  146. { Starting with V39, GadTools will skip any NewMenu entries whose
  147.  * nm_Type field has the NM_IGNORE bit set.
  148.  }
  149.  NM_IGNORE     =  64;
  150.  
  151.  
  152. { nm_Label should be a text string for textual items, a pointer
  153.  * to an Image structure for graphical menu items, or the special
  154.  * constant NM_BARLABEL, to get a separator bar.
  155.  }
  156.  NM_BARLABEL   = -1;
  157.  
  158. { The nm_Flags field is used to fill out either the Menu->Flags or
  159.  * MenuItem->Flags field.  Note that the sense of the MENUENABLED or
  160.  * ITEMENABLED bit is inverted between this use and Intuition's use,
  161.  * in other words, NewMenus are enabled by default.  The following
  162.  * labels are provided to disable them:
  163.  }
  164.  NM_MENUDISABLED = MENUENABLED;
  165.  NM_ITEMDISABLED = ITEMENABLED;
  166.  
  167. { New for V39:  NM_COMMANDSTRING.  For a textual MenuItem or SubItem,
  168.  * point nm_CommKey at an arbitrary string, and set the NM_COMMANDSTRING
  169.  * flag.
  170.  }
  171.  NM_COMMANDSTRING = COMMSEQ;
  172.  
  173. { The following are pre-cleared (COMMSEQ, ITEMTEXT, and HIGHxxx are set
  174.  * later as appropriate):
  175.  * Under V39, the COMMSEQ flag bit is not cleared, since it now has
  176.  * meaning.
  177.  }
  178.  NM_FLAGMASK    = NOT (COMMSEQ OR ITEMTEXT OR HIGHFLAGS);
  179.  NM_FLAGMASK_V39 = NOT (ITEMTEXT OR HIGHFLAGS);
  180.  
  181. { You may choose among CHECKIT, MENUTOGGLE, and CHECKED.
  182.  * Toggle-select menuitems are of type CHECKIT|MENUTOGGLE, along
  183.  * with CHECKED if currently selected.  Mutually exclusive ones
  184.  * are of type CHECKIT, and possibly CHECKED too.  The nm_MutualExclude
  185.  * is a bit-wise representation of the items excluded by this one,
  186.  * so in the simplest case (choose 1 among n), these flags would be
  187.  * ~1, ~2, ~4, ~8, ~16, etc.  See the Intuition Menus chapter.
  188.  }
  189.  
  190. { A UserData pointer can be associated with each Menu and MenuItem structure.
  191.  * The CreateMenus() call allocates space for a UserData after each
  192.  * Menu or MenuItem (header, item or sub-item).  You should use the
  193.  * GTMENU_USERDATA() or GTMENUITEM_USERDATA() macro to extract it.
  194.  }
  195.  
  196. const
  197. { These return codes can be obtained through the GTMN_SecondaryError tag }
  198.  GTMENU_TRIMMED = $00000001;      { Too many menus, items, or subitems,
  199.                                          * menu has been trimmed down
  200.                                          }
  201.  GTMENU_INVALID = $00000002;      { Invalid NewMenu array }
  202.  GTMENU_NOMEM   = $00000003;      { Out of memory }
  203.  
  204. {------------------------------------------------------------------------}
  205.  
  206. { Starting with V39, checkboxes and mx gadgets can be scaled to your
  207.  * specified gadget width/height.  Use the new GTCB_Scaled or GTMX_Scaled
  208.  * tags, respectively.  Under V37, and by default in V39, the imagery
  209.  * is of the following fixed size:
  210.  }
  211.  
  212. { MX gadget default dimensions: }
  213.  MX_WIDTH      =  17;
  214.  MX_HEIGHT     =  9;
  215.  
  216. { Checkbox default dimensions: }
  217.  CHECKBOX_WIDTH  = 26;
  218.  CHECKBOX_HEIGHT = 11;
  219.  
  220. {------------------------------------------------------------------------}
  221.  
  222.  
  223. {------------------------------------------------------------------------}
  224.  
  225. {  Tags for GadTools functions: }
  226. CONST
  227.  GT_TagBase        =   TAG_USER + $80000;
  228.  
  229.  GTVI_NewWindow    =   GT_TagBase+1;  { Unused }
  230.  GTVI_NWTags       =   GT_TagBase+2;  { Unused }
  231.  
  232.  GT_Private0       =   GT_TagBase+3;  { (private) }
  233.  
  234.  GTCB_Checked      =   GT_TagBase+4;  { State of checkbox }
  235.  
  236.  GTLV_Top          =   GT_TagBase+5;  { Top visible one in listview }
  237.  GTLV_Labels       =   GT_TagBase+6;  { List to display in listview }
  238.  GTLV_ReadOnly     =   GT_TagBase+7;  { TRUE IF listview is to be
  239.                                               read-only }
  240.  GTLV_ScrollWidth  =   GT_TagBase+8;  { Width of scrollbar }
  241.  
  242.  GTMX_Labels       =   GT_TagBase+9;  { NULL-terminated array of labels }
  243.  GTMX_Active       =   GT_TagBase+10; { Active one in mx gadget }
  244.  
  245.  GTTX_Text         =   GT_TagBase+11; { Text to display }
  246.  GTTX_CopyText     =   GT_TagBase+12; { Copy text label instead of
  247.                                               referencing it }
  248.  
  249.  GTNM_Number       =   GT_TagBase+13; { Number to display }
  250.  
  251.  GTCY_Labels       =   GT_TagBase+14; { NULL-terminated array of labels }
  252.  GTCY_Active       =   GT_TagBase+15; { The active one in the cycle gad }
  253.  
  254.  GTPA_Depth        =   GT_TagBase+16; { Number of bitplanes in palette }
  255.  GTPA_Color        =   GT_TagBase+17; { Palette color }
  256.  GTPA_ColorOffset  =   GT_TagBase+18; { First color to use in palette }
  257.  GTPA_IndicatorWidth = GT_TagBase+19; { Width of current-color indicator }
  258.  GTPA_IndicatorHeight = GT_TagBase+20; { Height of current-color indicator }
  259.  
  260.  GTSC_Top          =   GT_TagBase+21; { Top visible in scroller }
  261.  GTSC_Total        =   GT_TagBase+22; { Total in scroller area }
  262.  GTSC_Visible      =   GT_TagBase+23; { Number visible in scroller }
  263.  GTSC_Overlap      =   GT_TagBase+24; { Unused }
  264.  
  265. {  GT_TagBase+25 through GT_TagBase+37 are reserved }
  266.  
  267.  GTSL_Min          =   GT_TagBase+38; { Slider min value }
  268.  GTSL_Max          =   GT_TagBase+39; { Slider max value }
  269.  GTSL_Level        =   GT_TagBase+40; { Slider level }
  270.  GTSL_MaxLevelLen  =   GT_TagBase+41; { Max length of printed level }
  271.  GTSL_LevelFormat  =   GT_TagBase+42; { Format string for level }
  272.  GTSL_LevelPlace   =   GT_TagBase+43; { Where level should be placed }
  273.  GTSL_DispFunc     =   GT_TagBase+44; { Callback for number calculation
  274.                                               before display }
  275.  
  276.  GTST_String       =   GT_TagBase+45; { String gadget's displayed string }
  277.  GTST_MaxChars     =   GT_TagBase+46; { Max length of string }
  278.  
  279.  GTIN_Number       =   GT_TagBase+47; { Number in integer gadget }
  280.  GTIN_MaxChars     =   GT_TagBase+48; { Max number of digits }
  281.  
  282.  GTMN_TextAttr     =   GT_TagBase+49; { MenuItem font TextAttr }
  283.  GTMN_FrontPen     =   GT_TagBase+50; { MenuItem text pen color }
  284.  
  285.  GTBB_Recessed     =   GT_TagBase+51; { Make BevelBox recessed }
  286.  
  287.  GT_VisualInfo     =   GT_TagBase+52; { result of VisualInfo call }
  288.  
  289.  GTLV_ShowSelected =   GT_TagBase+53; { show selected entry beneath
  290.                 listview, set tag data = NULL for display-only, or pointer
  291.                 to a string gadget you've created }
  292.  GTLV_Selected     =   GT_TagBase+54; { Set ordinal number of selected
  293.                                               entry in the list }
  294.  GT_Reserved0      =   GT_TagBase+55; { Reserved }
  295.  GT_Reserved1      =   GT_TagBase+56; { Reserved for future use }
  296.  
  297.  GTTX_Border       =   GT_TagBase+57; { Put a border around
  298.                                               Text-display gadgets }
  299.  GTNM_Border       =   GT_TagBase+58; { Put a border around
  300.                                               Number-display gadgets }
  301.  
  302.  GTSC_Arrows       =   GT_TagBase+59; { Specify size of arrows for
  303.                                               scroller }
  304.  
  305.  GTMN_Menu         =   GT_TagBase+60; { Pointer to Menu for use by
  306.                                               LayoutMenuItems() }
  307.  GTMX_Spacing      =   GT_TagBase+61; { Added to font height to
  308.                 figure spacing between mx choices.  Use this instead
  309.                 of LAYOUTA_SPACING for mx gadgets. }
  310.  
  311. { New to V37 GadTools.  Ignored by GadTools V36 }
  312.  GTMN_FullMenu     =   GT_TagBase+62; { Asks CreateMenus() to
  313.                 validate that this is a complete menu structure }
  314.  GTMN_SecondaryError =  GT_TagBase+63; { ti_Data is a pointer
  315.                 to a ULONG to receive error reports from CreateMenus() }
  316.  GT_Underscore     =   GT_TagBase+64; { ti_Data points to the symbol
  317.                 that preceeds the character you'd like to underline in a
  318.                 gadget label }
  319.  
  320. { New to V39 GadTools.  Ignored by GadTools V36 and V37 }
  321.  GTMN_Checkmark     =  GT_TagBase+65; { ti_Data is checkmark img to use }
  322.  GTMN_AmigaKey      =  GT_TagBase+66; { ti_Data is Amiga-key img to use }
  323.  GTMN_NewLookMenus  =  GT_TagBase+67; { ti_Data is boolean }
  324.  
  325. { New to V39 GadTools.  Ignored by GadTools V36 and V37.
  326.  * Set to TRUE if you want the checkbox or mx image scaled to
  327.  * the gadget width/height you specify.  Defaults to FALSE,
  328.  * for compatibility.
  329.  }
  330.  GTCB_Scaled         = GT_TagBase+68; { ti_Data is boolean }
  331.  GTMX_Scaled         = GT_TagBase+69; { ti_Data is boolean }
  332.  
  333.  GTPA_NumColors      = GT_TagBase+70; { Number of colors in palette }
  334.  
  335.  GTMX_TitlePlace     = GT_TagBase+71; { Where to put the title }
  336.  
  337.  GTTX_FrontPen       = GT_TagBase+72; { Text color in TEXT_KIND gad }
  338.  GTTX_BackPen        = GT_TagBase+73; { Bgrnd color in TEXT_KIND gad }
  339.  GTTX_Justification  = GT_TagBase+74; { See GTJ_#? constants }
  340.  
  341.  GTNM_FrontPen       = GT_TagBase+72; { Text color in NUMBER_KIND gad }
  342.  GTNM_BackPen        = GT_TagBase+73; { Bgrnd color in NUMBER_KIND gad }
  343.  GTNM_Justification  = GT_TagBase+74; { See GTJ_#? constants }
  344.  GTNM_Format         = GT_TagBase+75; { Formatting string for number }
  345.  GTNM_MaxNumberLen   = GT_TagBase+76; { Maximum length of number }
  346.  
  347.  GTBB_FrameType      = GT_TagBase+77; { defines what kind of boxes
  348.                                             * DrawBevelBox() renders. See
  349.                                             * the BBFT_#? constants for
  350.                                             * possible values
  351.                                             }
  352.  
  353.  GTLV_MakeVisible    = GT_TagBase+78; { Make this item visible }
  354.  GTLV_ItemHeight     = GT_TagBase+79; { Height of an individual item }
  355.  
  356.  GTSL_MaxPixelLen    = GT_TagBase+80; { Max pixel size of level display }
  357.  GTSL_Justification  = GT_TagBase+81; { how should the level be displayed }
  358.  
  359.  GTPA_ColorTable     = GT_TagBase+82; { colors to use in palette }
  360.  
  361.  GTLV_CallBack       = GT_TagBase+83; { general-purpose listview call back }
  362.  GTLV_MaxPen         = GT_TagBase+84; { maximum pen number used by call back }
  363.  
  364.  GTTX_Clipped        = GT_TagBase+85; { make a TEXT_KIND clip text }
  365.  GTNM_Clipped        = GT_TagBase+85; { make a NUMBER_KIND clip text }
  366.  
  367.  
  368. {------------------------------------------------------------------------}
  369.  
  370. { Justification types for GTTX_Justification and GTNM_Justification tags }
  371.  GTJ_LEFT   = 0;
  372.  GTJ_RIGHT  = 1;
  373.  GTJ_CENTER = 2;
  374.  
  375. {------------------------------------------------------------------------}
  376.  
  377. { Bevel box frame types for GTBB_FrameType tag }
  378.  BBFT_BUTTON      = 1;  { Standard button gadget box }
  379.  BBFT_RIDGE       = 2;  { Standard string gadget box }
  380.  BBFT_ICONDROPBOX = 3;  { Standard icon drop box     }
  381.  
  382. {------------------------------------------------------------------------}
  383.  
  384. { Typical suggested spacing between "elements": }
  385.  INTERWIDTH    =  8;
  386.  INTERHEIGHT   =  4;
  387.  
  388. {------------------------------------------------------------------------}
  389.  
  390.  
  391. {  "NWay" is an old synonym for cycle gadgets }
  392.  NWAY_KIND    =   CYCLE_KIND;
  393.  NWAYIDCMP    =   CYCLEIDCMP;
  394.  GTNW_Labels  =   GTCY_Labels;
  395.  GTNW_Active  =   GTCY_Active;
  396.  
  397. {------------------------------------------------------------------------}
  398.  
  399. { These two definitions are obsolete, but are here for backwards
  400.  * compatibility.  You never need to worry about these:
  401.  }
  402.  GADTOOLBIT    =  ($8000);
  403. { Use this mask to isolate the user part: }
  404.  GADTOOLMASK   =  NOT (GADTOOLBIT);
  405.  
  406. {------------------------------------------------------------------------}
  407.  
  408. { These definitions are for the GTLV_CallBack tag }
  409.  
  410. { The different types of messages that a listview callback hook can see }
  411.  LV_DRAW     =  $202;    { draw yourself, with state }
  412.  
  413. { Possible return values from a callback hook }
  414.  LVCB_OK      = 0;         { callback understands this message type    }
  415.  LVCB_UNKNOWN = 1;         { callback does not understand this message }
  416.  
  417. { states for LVDrawMsg.lvdm_State }
  418.  LVR_NORMAL           = 0; { the usual                 }
  419.  LVR_SELECTED         = 1; { for selected gadgets      }
  420.  LVR_NORMALDISABLED   = 2;         { for disabled gadgets      }
  421.  LVR_SELECTEDDISABLED = 8;         { disabled and selected     }
  422.  
  423. Type
  424. { structure of LV_DRAW messages, object is a (struct Node *) }
  425.  pLVDrawMsg = ^tLVDrawMsg;
  426.  tLVDrawMsg = record
  427.     lvdm_MethodID       : ULONG;       { LV_DRAW                   }
  428.     lvdm_RastPort       : pRastPort;   { where to render to        }
  429.     lvdm_DrawInfo       : pDrawInfo;   { useful to have around     }
  430.     lvdm_Bounds         : tRectangle;  { limits of where to render }
  431.     lvdm_State          : ULONG;     { how to render     }
  432.  end;
  433.  
  434.  
  435. VAR
  436.     GadToolsBase : pLibrary;
  437.  
  438. FUNCTION CreateContext(glistptr : pGadget): pGadget;
  439. FUNCTION CreateGadgetA(kind : ULONG; gad : pGadget; ng : pNewGadget; taglist : pTagItem) : pGadget;
  440. FUNCTION CreateMenusA(newmenu : pNewMenu; taglist : pTagItem) : pMenu;
  441. PROCEDURE DrawBevelBoxA(rport : pRastPort; left : LONGINT; top : LONGINT; width : LONGINT; height : LONGINT; taglist : pTagItem);
  442. PROCEDURE FreeGadgets(gad : pGadget);
  443. PROCEDURE FreeMenus(menu : pMenu);
  444. PROCEDURE FreeVisualInfo(vi : POINTER);
  445. FUNCTION GetVisualInfoA(screen : pScreen; taglist : pTagItem) : POINTER;
  446. PROCEDURE GT_BeginRefresh(win : pWindow);
  447. PROCEDURE GT_EndRefresh(win : pWindow; complete : LONGINT);
  448. FUNCTION GT_FilterIMsg(imsg : pIntuiMessage) : pIntuiMessage;
  449. FUNCTION GT_GetGadgetAttrsA(gad : pGadget; win : pWindow; req : pRequester; taglist : pTagItem) : LONGINT;
  450. FUNCTION GT_GetIMsg(iport : pMsgPort) : pIntuiMessage;
  451. FUNCTION GT_PostFilterIMsg(imsg : pIntuiMessage) : pIntuiMessage;
  452. PROCEDURE GT_RefreshWindow(win : pWindow; req : pRequester);
  453. PROCEDURE GT_ReplyIMsg(imsg : pIntuiMessage);
  454. PROCEDURE GT_SetGadgetAttrsA(gad : pGadget; win : pWindow; req : pRequester; taglist : pTagItem);
  455. FUNCTION LayoutMenuItemsA(firstitem : pMenuItem; vi : POINTER; taglist : pTagItem) : BOOLEAN;
  456. FUNCTION LayoutMenusA(firstmenu : pMenu; vi : POINTER; taglist : pTagItem) : BOOLEAN;
  457.  
  458. IMPLEMENTATION
  459.  
  460. FUNCTION CreateContext(glistptr : pGadget): pGadget;
  461. BEGIN
  462.   ASM
  463.     MOVE.L  A6,-(A7)
  464.     MOVEA.L glistptr,A0
  465.     MOVEA.L GadToolsBase,A6
  466.     JSR -114(A6)
  467.     MOVEA.L (A7)+,A6
  468.     MOVE.L  D0,@RESULT
  469.   END;
  470. END;
  471.  
  472. FUNCTION CreateGadgetA(kind : ULONG; gad : pGadget; ng : pNewGadget; taglist : pTagItem) : pGadget;
  473. BEGIN
  474.   ASM
  475.     MOVE.L  A6,-(A7)
  476.     MOVE.L  kind,D0
  477.     MOVEA.L gad,A0
  478.     MOVEA.L ng,A1
  479.     MOVEA.L taglist,A2
  480.     MOVEA.L GadToolsBase,A6
  481.     JSR -030(A6)
  482.     MOVEA.L (A7)+,A6
  483.     MOVE.L  D0,@RESULT
  484.   END;
  485. END;
  486.  
  487. FUNCTION CreateMenusA(newmenu : pNewMenu; taglist : pTagItem) : pMenu;
  488. BEGIN
  489.   ASM
  490.     MOVE.L  A6,-(A7)
  491.     MOVEA.L newmenu,A0
  492.     MOVEA.L taglist,A1
  493.     MOVEA.L GadToolsBase,A6
  494.     JSR -048(A6)
  495.     MOVEA.L (A7)+,A6
  496.     MOVE.L  D0,@RESULT
  497.   END;
  498. END;
  499.  
  500. PROCEDURE DrawBevelBoxA(rport : pRastPort; left : LONGINT; top : LONGINT; width : LONGINT; height : LONGINT; taglist : pTagItem);
  501. BEGIN
  502.   ASM
  503.     MOVE.L  A6,-(A7)
  504.     MOVEA.L rport,A0
  505.     MOVE.L  left,D0
  506.     MOVE.L  top,D1
  507.     MOVE.L  width,D2
  508.     MOVE.L  height,D3
  509.     MOVEA.L taglist,A1
  510.     MOVEA.L GadToolsBase,A6
  511.     JSR -120(A6)
  512.     MOVEA.L (A7)+,A6
  513.   END;
  514. END;
  515.  
  516. PROCEDURE FreeGadgets(gad : pGadget);
  517. BEGIN
  518.   ASM
  519.     MOVE.L  A6,-(A7)
  520.     MOVEA.L gad,A0
  521.     MOVEA.L GadToolsBase,A6
  522.     JSR -036(A6)
  523.     MOVEA.L (A7)+,A6
  524.   END;
  525. END;
  526.  
  527. PROCEDURE FreeMenus(menu : pMenu);
  528. BEGIN
  529.   ASM
  530.     MOVE.L  A6,-(A7)
  531.     MOVEA.L menu,A0
  532.     MOVEA.L GadToolsBase,A6
  533.     JSR -054(A6)
  534.     MOVEA.L (A7)+,A6
  535.   END;
  536. END;
  537.  
  538. PROCEDURE FreeVisualInfo(vi : POINTER);
  539. BEGIN
  540.   ASM
  541.     MOVE.L  A6,-(A7)
  542.     MOVEA.L vi,A0
  543.     MOVEA.L GadToolsBase,A6
  544.     JSR -132(A6)
  545.     MOVEA.L (A7)+,A6
  546.   END;
  547. END;
  548.  
  549. FUNCTION GetVisualInfoA(screen : pScreen; taglist : pTagItem) : POINTER;
  550. BEGIN
  551.   ASM
  552.     MOVE.L  A6,-(A7)
  553.     MOVEA.L screen,A0
  554.     MOVEA.L taglist,A1
  555.     MOVEA.L GadToolsBase,A6
  556.     JSR -126(A6)
  557.     MOVEA.L (A7)+,A6
  558.     MOVE.L  D0,@RESULT
  559.   END;
  560. END;
  561.  
  562. PROCEDURE GT_BeginRefresh(win : pWindow);
  563. BEGIN
  564.   ASM
  565.     MOVE.L  A6,-(A7)
  566.     MOVEA.L win,A0
  567.     MOVEA.L GadToolsBase,A6
  568.     JSR -090(A6)
  569.     MOVEA.L (A7)+,A6
  570.   END;
  571. END;
  572.  
  573. PROCEDURE GT_EndRefresh(win : pWindow; complete : LONGINT);
  574. BEGIN
  575.   ASM
  576.     MOVE.L  A6,-(A7)
  577.     MOVEA.L win,A0
  578.     MOVE.L  complete,D0
  579.     MOVEA.L GadToolsBase,A6
  580.     JSR -096(A6)
  581.     MOVEA.L (A7)+,A6
  582.   END;
  583. END;
  584.  
  585. FUNCTION GT_FilterIMsg(imsg : pIntuiMessage) : pIntuiMessage;
  586. BEGIN
  587.   ASM
  588.     MOVE.L  A6,-(A7)
  589.     MOVEA.L imsg,A1
  590.     MOVEA.L GadToolsBase,A6
  591.     JSR -102(A6)
  592.     MOVEA.L (A7)+,A6
  593.     MOVE.L  D0,@RESULT
  594.   END;
  595. END;
  596.  
  597. FUNCTION GT_GetGadgetAttrsA(gad : pGadget; win : pWindow; req : pRequester; taglist : pTagItem) : LONGINT;
  598. BEGIN
  599.   ASM
  600.     MOVE.L  A6,-(A7)
  601.     MOVEA.L gad,A0
  602.     MOVEA.L win,A1
  603.     MOVEA.L req,A2
  604.     MOVEA.L taglist,A3
  605.     MOVEA.L GadToolsBase,A6
  606.     JSR -174(A6)
  607.     MOVEA.L (A7)+,A6
  608.     MOVE.L  D0,@RESULT
  609.   END;
  610. END;
  611.  
  612. FUNCTION GT_GetIMsg(iport : pMsgPort) : pIntuiMessage;
  613. BEGIN
  614.   ASM
  615.     MOVE.L  A6,-(A7)
  616.     MOVEA.L iport,A0
  617.     MOVEA.L GadToolsBase,A6
  618.     JSR -072(A6)
  619.     MOVEA.L (A7)+,A6
  620.     MOVE.L  D0,@RESULT
  621.   END;
  622. END;
  623.  
  624. FUNCTION GT_PostFilterIMsg(imsg : pIntuiMessage) : pIntuiMessage;
  625. BEGIN
  626.   ASM
  627.     MOVE.L  A6,-(A7)
  628.     MOVEA.L imsg,A1
  629.     MOVEA.L GadToolsBase,A6
  630.     JSR -108(A6)
  631.     MOVEA.L (A7)+,A6
  632.     MOVE.L  D0,@RESULT
  633.   END;
  634. END;
  635.  
  636. PROCEDURE GT_RefreshWindow(win : pWindow; req : pRequester);
  637. BEGIN
  638.   ASM
  639.     MOVE.L  A6,-(A7)
  640.     MOVEA.L win,A0
  641.     MOVEA.L req,A1
  642.     MOVEA.L GadToolsBase,A6
  643.     JSR -084(A6)
  644.     MOVEA.L (A7)+,A6
  645.   END;
  646. END;
  647.  
  648. PROCEDURE GT_ReplyIMsg(imsg : pIntuiMessage);
  649. BEGIN
  650.   ASM
  651.     MOVE.L  A6,-(A7)
  652.     MOVEA.L imsg,A1
  653.     MOVEA.L GadToolsBase,A6
  654.     JSR -078(A6)
  655.     MOVEA.L (A7)+,A6
  656.   END;
  657. END;
  658.  
  659. PROCEDURE GT_SetGadgetAttrsA(gad : pGadget; win : pWindow; req : pRequester; taglist : pTagItem);
  660. BEGIN
  661.   ASM
  662.     MOVE.L  A6,-(A7)
  663.     MOVEA.L gad,A0
  664.     MOVEA.L win,A1
  665.     MOVEA.L req,A2
  666.     MOVEA.L taglist,A3
  667.     MOVEA.L GadToolsBase,A6
  668.     JSR -042(A6)
  669.     MOVEA.L (A7)+,A6
  670.   END;
  671. END;
  672.  
  673. FUNCTION LayoutMenuItemsA(firstitem : pMenuItem; vi : POINTER; taglist : pTagItem) : BOOLEAN;
  674. BEGIN
  675.   ASM
  676.     MOVE.L  A6,-(A7)
  677.     MOVEA.L firstitem,A0
  678.     MOVEA.L vi,A1
  679.     MOVEA.L taglist,A2
  680.     MOVEA.L GadToolsBase,A6
  681.     JSR -060(A6)
  682.     MOVEA.L (A7)+,A6
  683.     TST.W   D0
  684.     BEQ.B   @end
  685.     MOVEQ   #1,D0
  686.   @end: MOVE.B  D0,@RESULT
  687.   END;
  688. END;
  689.  
  690. FUNCTION LayoutMenusA(firstmenu : pMenu; vi : POINTER; taglist : pTagItem) : BOOLEAN;
  691. BEGIN
  692.   ASM
  693.     MOVE.L  A6,-(A7)
  694.     MOVEA.L firstmenu,A0
  695.     MOVEA.L vi,A1
  696.     MOVEA.L taglist,A2
  697.     MOVEA.L GadToolsBase,A6
  698.     JSR -066(A6)
  699.     MOVEA.L (A7)+,A6
  700.     TST.W   D0
  701.     BEQ.B   @end
  702.     MOVEQ   #1,D0
  703.   @end: MOVE.B  D0,@RESULT
  704.   END;
  705. END;
  706.  
  707. END. (* UNIT GADTOOLS *)
  708.  
  709.  
  710.  
  711.